from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QWidget

width = 950
height = 700


class BaseWin(QWidget):

    def __init__(self, app):
        self.app = app
        super(BaseWin, self).__init__()
        # self.setFixedSize(width, height)  # 禁止调整大小
        self.resize(width, height)
        self.setWindowIcon(QIcon('./configuration/favicon.ico'))

    def set_left(self):
        desktop = self.app.desktop()
        # 需要int类型的数据，float可能在后续版本会删除
        self.move(int((desktop.width() - self.width() * 2)), int((desktop.height() - self.height()) / 2))

    def set_center(self):
        desktop = self.app.desktop()
        # 需要int类型的数据，float可能在后续版本会删除
        self.move(int((desktop.width() / 2 - self.width() / 2)), int((desktop.height() - self.height()) / 2))
